package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.pojo.DtsCategory;
import com.qf.vo.CatVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 类目表 Mapper 接口
 * </p>
 *
 * @author zhaojian
 * @since 2021-05-12
 */
public interface DtsCategoryMapper extends BaseMapper<DtsCategory> {
    @Select("select id  `value`, name label from dts_category where level='L1'")
    public List<CatVo> findIdAndName();

    @Select("select id `value`, name label from dts_category where level='L1'")
    public List<CatVo> findlevel();

    @Select("SELECT " +
            " a.id pid , b.id ,b.name " +
            " FROM " +
            " dts_category a" +
            " LEFT JOIN dts_category b ON a.id = b.pid ")
    public List<DtsCategory> findlevelL2();
}
